<!DOCTYPE html>
<!-- saved from url=(0047)https://www.greendizer.com/docs/libraries/xmli/ -->
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#" xmlns:fb="http://www.facebook.com/2008/fbml" lang="en" class=" js borderradius boxshadow textshadow opacity"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><script src="./Libraries cookbook to generate XMLi and create invoices - Greendizer_files/cb=gapi.loaded0" async=""></script><script type="text/javascript" async="" src="./Libraries cookbook to generate XMLi and create invoices - Greendizer_files/plusone.js" gapi_processed="true"></script><script type="text/javascript" async="" src="./Libraries cookbook to generate XMLi and create invoices - Greendizer_files/ga.js"></script><script type="text/javascript" async="" src="./Libraries cookbook to generate XMLi and create invoices - Greendizer_files/ga.js"></script><script type="text/javascript">
//<![CDATA[
try{if (!window.CloudFlare) { var CloudFlare=[{verbose:0,p:0,byc:0,owlid:0,mirage:0,oracle:"82/3f73793a7b7aa6a429141ec16904d2",paths:{cloudflare:"/cdn-cgi/nexp/v=1443929931/"},atok:"4e06fa8b804fb039e1f08e68ed044898",zone:"greendizer.com",rocket:"0",apps:{"ga_key":{"ua":"UA-23409453-4","ga_bs":"2"}}}];document.write('<script type="text/javascript" src="//ajax.cloudflare.com/cdn-cgi/nexp/v=3368044129/cloudflare.min.js"><'+'\/script>')}}catch(a){};
//]]>
</script><script type="text/javascript" src="./Libraries cookbook to generate XMLi and create invoices - Greendizer_files/cloudflare.min.js"></script>
<script type="text/javascript">
//<![CDATA[
window.__CF=window.__CF||{};window.__CF.AJS={"ga_key":{"ua":"UA-23409453-4","ga_bs":"2"}};
//]]>
</script>
<title>Libraries cookbook to generate XMLi and create invoices - Greendizer</title>
<script type="text/javascript">
(function(){
    try{ 
        var contentLanguage = document.getElementsByTagName("html")[0].lang;
        var cookieLocale;
        
        var urlMatch = window.location.href.match(new RegExp("\/([a-z]{2})\/", "i"));
        var urlLocale = urlMatch ? urlMatch[1] : "en";
        var browserLanguage = (window.navigator.language || 
                               window.navigator.browserLanguage).split("-")[0];
        
        //Building a hash of the available alternates to the current page.
        var alternates = {};
        var links = document.getElementsByTagName("link");
        for(var j=0; j < links.length; j++){
            alternates[links[j].hreflang] = links[j].href;
        }
        
        //Looking for the "locale" cookie.
        var cookies = document.cookie.split("; ");
        for(var i=0; i < cookies.length; i++){
            var parts = cookies[i].split("=");
            if(parts[0] === "locale"){
                cookieLocale = parts[1];
                
                if(parts[1] === contentLanguage){
                    /**
                     * Ideal case: the page's language matched the preferred
                     * language of the user according to the value carried
                     * by the "locale" cookie. 
                     */
                    return;
                } else if (parts[1] in alternates) {
                    /**
                     * Preferred language doesn't match the page's content language,
                     * but an alternate is available. 
                     */
                    window.location.href = alternates[parts[1]];
                }
                break;
            }
        }       
        
        /*
         * Case of a page loaded with from the cache,
         * and no cookie could be written by the server.
         */
        if(!cookieLocale && 
            contentLanguage === urlMatch &&
            browserLanguage !== contentLanguage){
            document.cookie = ["locale=" + contentLanguage,
                               "Path=/",
                               "Domain=.greendizer.com",
                               "Expires=" + new Date(new Date().getTime() + 999999999000).toUTCString(),
                               window.location.href.substr(0, 5) === "https" ? "secure" : ""].join('; ');
        }
        
        //Case of a first time visit, with no "locale" cookie available.
        if(!cookieLocale){
            /**
             * the content language is different from the default language
             * reported by the browser. Redirect the user if an alternate
             * in the user's preferred language is available.
             */
            if( (!urlMatch || urlLocale !== contentLanguage) &&
                browserLanguage !== contentLanguage &&
                browserLanguage in alternates){
                window.location.href = alternates[browserLanguage];
            }
        }
    } catch(e){;}
})();
</script>
<meta http-equiv="Content-Language" content="en">
<meta charset="text/html; charset=utf-8">
<meta name="viewport" content="width=1024">
<meta name="description" content="Libs to create invoices in Python, Java, PHP and .NET">
<meta name="keywords" content="invoice,bill,biller,seller,buyer,invoicer,exchange,estimate,quote,message,payment,developer,designer,company,business,invoicing,online,archive,realtime,application,apps,marketplace,viewer,creator,api,rest,leweb,cloud,computing,library,libraries,python,py,java,c#,csharp,php,js,javascript,digital,signature,rsa,encrypted,xmldsig,xml">
<meta name="robots" content="index,follow,noimageindex">
<meta name="slurp" content="nodir">
<meta name="author" content="Greendizer">
<meta name="copyright" content="2012 Greendizer SA">
<meta property="og:type" content="product">
<meta property="og:url" content="https://www.greendizer.com/">
<meta property="og:description" content="APIs and tools to add cloud-based invoicing capabilities to your systems, and build apps with realtime data from the invoices exchanges.">
<meta property="og:site_name" content="Greendizer">
<meta property="og:title" content="Greendizer">
<meta property="og:image" content="https://www.greendizer.com/static/images/logo.jpg">
<meta property="og:street-address" content="15 rue de Chambery">
<meta property="og:postal-code" content="75015">
<meta property="og:locality" content="Paris">
<meta property="og:country-name" content="France">
<meta property="fb:admins" content="563670170,612569218,568453298,561205053">
<meta property="fb:app_id" content="73222341311">
<link rel="publisher" href="https://plus.google.com/118361734809275351334">
<link rel="index" hreflang="en" href="https://www.greendizer.com/sitemap/">
<link type="text/css" href="./Libraries cookbook to generate XMLi and create invoices - Greendizer_files/www.css" rel="stylesheet">
<link type="text/css" href="./Libraries cookbook to generate XMLi and create invoices - Greendizer_files/www.columns.css" rel="stylesheet">
<script type="text/javascript" src="./Libraries cookbook to generate XMLi and create invoices - Greendizer_files/jquery.js"></script>
<script type="text/javascript" src="./Libraries cookbook to generate XMLi and create invoices - Greendizer_files/jquery-ui.min.js"></script>
<script type="text/javascript" src="./Libraries cookbook to generate XMLi and create invoices - Greendizer_files/saved_resource"></script>
<script type="text/javascript" src="./Libraries cookbook to generate XMLi and create invoices - Greendizer_files/greendizer.common.min.js"></script>
<script type="text/javascript" src="./Libraries cookbook to generate XMLi and create invoices - Greendizer_files/greendizer.website.min.js"></script>
<link type="text/css" rel="stylesheet" href="./Libraries cookbook to generate XMLi and create invoices - Greendizer_files/www.docs.css">
<link type="text/css" rel="stylesheet" href="./Libraries cookbook to generate XMLi and create invoices - Greendizer_files/prettify.css">
<script type="text/javascript">
/* <![CDATA[ */
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-23409453-4']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

(function(b){(function(a){"__CF"in b&&"DJS"in b.__CF?b.__CF.DJS.push(a):"addEventListener"in b?b.addEventListener("load",a,!1):b.attachEvent("onload",a)})(function(){"FB"in b&&"Event"in FB&&"subscribe"in FB.Event&&(FB.Event.subscribe("edge.create",function(a){_gaq.push(["_trackSocial","facebook","like",a])}),FB.Event.subscribe("edge.remove",function(a){_gaq.push(["_trackSocial","facebook","unlike",a])}),FB.Event.subscribe("message.send",function(a){_gaq.push(["_trackSocial","facebook","send",a])}));"twttr"in b&&"events"in twttr&&"bind"in twttr.events&&twttr.events.bind("tweet",function(a){if(a){var b;if(a.target&&a.target.nodeName=="IFRAME")a:{if(a=a.target.src){a=a.split("#")[0].match(/[^?=&]+=([^&]*)?/g);b=0;for(var c;c=a[b];++b)if(c.indexOf("url")===0){b=unescape(c.split("=")[1]);break a}}b=void 0}_gaq.push(["_trackSocial","twitter","tweet",b])}})})})(window);
/* ]]> */
</script>
<script type="text/javascript" src="./Libraries cookbook to generate XMLi and create invoices - Greendizer_files/saved_resource(1)"></script><style type="text/css">.gssb_c{border:0;position:absolute;z-index:989}.gssb_e{border:1px solid #ccc;border-top-color:#d9d9d9;box-shadow:0 2px 4px rgba(0,0,0,0.2);-webkit-box-shadow:0 2px 4px rgba(0,0,0,0.2);cursor:default}.gssb_f{visibility:hidden;white-space:nowrap}.gssb_k{border:0;display:block;position:absolute;top:0;z-index:988}.gsib_a{width:100%;padding:4px 6px 0}.gsib_a,.gsib_b{vertical-align:top}.gssb_a{padding:0 7px}.gssb_a,.gssb_a td{white-space:nowrap;overflow:hidden;line-height:22px}#gssb_b{font-size:11px;color:#36c;text-decoration:none}#gssb_b:hover{font-size:11px;color:#36c;text-decoration:underline}.gssb_m{color:#000;background:#fff}.gssb_g{text-align:center;padding:8px 0 7px;position:relative}.gssb_h{font-size:15px;height:28px;margin:0.2em;-webkit-appearance:button}.gssb_i{background:#eee}.gss_ifl{visibility:hidden;padding-left:5px}.gssb_i .gss_ifl{visibility:visible}a.gssb_j{font-size:13px;color:#36c;text-decoration:none;line-height:100%}a.gssb_j:hover{text-decoration:underline}.gssb_l{height:1px;background-color:#e5e5e5}.gsq_a{padding:0}.gscsep_a{display:none}.gsfe_a{border:1px solid #b9b9b9;border-top-color:#a0a0a0;box-shadow:inset 0px 1px 2px rgba(0,0,0,0.1);-moz-box-shadow:inset 0px 1px 2px rgba(0,0,0,0.1);-webkit-box-shadow:inset 0px 1px 2px rgba(0,0,0,0.1);}.gsfe_b{border:1px solid #4d90fe;outline:none;box-shadow:inset 0px 1px 2px rgba(0,0,0,0.3);-moz-box-shadow:inset 0px 1px 2px rgba(0,0,0,0.3);-webkit-box-shadow:inset 0px 1px 2px rgba(0,0,0,0.3);}.gscb_a{display:inline-block;font:27px/13px arial,sans-serif}.gsst_a .gscb_a{color:#a1b9ed;cursor:pointer}.gsst_a:hover .gscb_a{color:#36c}.gsst_a,.gsst_d{display:inline-block}.gsst_a{cursor:pointer;padding:0 3px}.gsst_a:hover{text-decoration:none!important}.gsst_b{font-size:16px;padding:0 3px;user-select:none;-webkit-user-select:none;white-space:nowrap}.gsst_d{width:4px}.gsst_e{opacity:0.55;}.gsst_a:hover .gsst_e{opacity:0.72;}.gsst_a:active .gsst_e{opacity:1;}.gssb_a{padding:0 7px}.gssb_e{border:0}.gssb_l{margin:5px 0}.gssb_c .gsc-completion-container{position:static}.gssb_c{z-index:5000}.gsc-completion-container table{background:transparent;font-size:inherit;font-family:inherit}.gssb_c > tbody > tr,.gssb_c > tbody > tr > td,.gssb_d,.gssb_d > tbody > tr,.gssb_d > tbody > tr > td,.gssb_e,.gssb_e > tbody > tr,.gssb_e > tbody > tr > td{padding:0;margin:0;border:0}.gssb_a table,.gssb_a table tr,.gssb_a table tr td{padding:0;margin:0;border:0}</style><script type="text/javascript" src="./Libraries cookbook to generate XMLi and create invoices - Greendizer_files/search.I.js"></script></head>
<body><div id="StayFocusd-infobar" style="display: none; top: 0px; "><img src="chrome-extension://laankejkbhbdhmipfmgcngdelahlfoji/img/eye_19x19_red.png"><span id="StayFocusd-infobar-msg"></span><span id="StayFocusd-infobar-links"><a href="https://www.greendizer.com/docs/libraries/xmli/#" id="StayFocusd-infobar-never-show">hide forever</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="https://www.greendizer.com/docs/libraries/xmli/#" id="StayFocusd-infobar-hide">hide once</a></span></div>
<div id="wrapper">
<div style="display:none;" class="language-warning"><img alt="" src="./Libraries cookbook to generate XMLi and create invoices - Greendizer_files/en_flag.png"><span></span></div>
<script type="text/javascript" src="./Libraries cookbook to generate XMLi and create invoices - Greendizer_files/widgets.min.js"></script>
<iframe style="display: none; position: fixed; width: 100%; height: 100%; z-index: 9999; top: 0px; left: 0px; background-color: transparent; " id="launchpad" frameborder="0" name="lang=en&amp;origin=https%3A//www.greendizer.com&amp;id=13360943517560.7288471620995551" data-gd-id="13360943517560.7288471620995551" src="./Libraries cookbook to generate XMLi and create invoices - Greendizer_files/saved_resource(4).htm"></iframe>
<script type="text/javascript">
(function(){
    window.greendizer = window.greendizer || {};
    window.greendizer.showCentral = function(){
        var widget = greendizer.widgets.widgetManager.getInstance().getWidget($("#launchpad").get(0));
        widget && greendizer.website.Context.getInstance().isAuthenticated() && widget.show();
    };
})();
</script>
<header>
<span id="login-warning" style="display:none;" onclick="$(this).hide();" class="global-warning rounded-bottom">Login is not available at this time - Please try again in a moment.</span>
<a href="https://www.greendizer.com/"><img id="logo" alt="Greendizer" src="./Libraries cookbook to generate XMLi and create invoices - Greendizer_files/logo.png"></a>
<div style="display: none; " id="user-surface">
<div id="user-surface-avatar">
<img id="user-surface-user-avatar" onerror="this.src=&#39;/static/images/userdefault.png&#39;" class="user">
<img id="user-surface-company-logo" style="display:none" class="company" width="32" height="32" onerror="this.src=&#39;/static/images/companydefault.128.png&#39;">
<div class="section">
<img onclick="window.greendizer.showCentral()" title="Central" id="user-surface-central" class="central" src="./Libraries cookbook to generate XMLi and create invoices - Greendizer_files/gd32.png" alt="Central">
</div>
</div>
<div id="user-surface-name" class=" dark"></div>
</div>
<div id="header-buttons">
<a href="https://services.greendizer.com/signup/?locale=en" class="logged-out-only button" id="signup-button">Sign up</a>
<button onclick="greendizer.website.Context.getInstance().login(true)" style="" id="login">Login</button>
</div>
<img style="display: none; " id="login-loader" src="./Libraries cookbook to generate XMLi and create invoices - Greendizer_files/loader.gif">
<nav id="nav-menu">
<a class=" dark" href="https://www.greendizer.com/features/">Features</a>
<a class=" light" href="https://www.greendizer.com/pricing/">Pricing</a>
<a class="focus dark" href="https://www.greendizer.com/docs/">Docs</a>
<a class=" light" href="https://www.greendizer.com/blog/">Blog</a>
</nav>
</header>
<section id="content">
<style type="text/css">#wrapper.pin-pushed #sub-menu #cse{display:none;}</style>
<section id="sub-menu">
<ul>
<li>
<h1>APIs</h1>
<ul>
<li><a hreflang="en" href="https://www.greendizer.com/docs/api/">Basics</a></li>
<li><a hreflang="en" href="https://www.greendizer.com/docs/api/oauth/">OAuth</a></li>
<li><a hreflang="en" href="https://www.greendizer.com/docs/api/sellers/">Sellers</a></li>
<li><a hreflang="en" href="https://www.greendizer.com/docs/api/buyers/">Buyers</a></li>
<li><a hreflang="en" href="https://www.greendizer.com/docs/api/xmli/">XMLi</a></li>
<li><a hreflang="en" href="https://www.greendizer.com/docs/api/public/">Public resources</a></li>
</ul>
</li>
<li class="focus">
<h1>Libraries</h1>
<ul>
<li><a hreflang="en" href="https://www.greendizer.com/docs/libraries/">Basics</a></li>
<li><a hreflang="en" href="https://www.greendizer.com/docs/libraries/sellers/">Sellers</a></li>
<li><a hreflang="en" href="https://www.greendizer.com/docs/libraries/buyers/">Buyers</a></li>
<li class="focus"><a hreflang="en" href="./Libraries cookbook to generate XMLi and create invoices - Greendizer_files/Libraries cookbook to generate XMLi and create invoices - Greendizer.htm">XMLi</a><div id="___plusone_0" style="height: 15px; width: 70px; display: inline-block; text-indent: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; float: none; line-height: normal; font-size: 1px; vertical-align: baseline; background-position: initial initial; background-repeat: initial initial; "><iframe allowtransparency="true" frameborder="0" hspace="0" marginheight="0" marginwidth="0" scrolling="no" style="width: 70px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; height: 15px; position: static; left: 0px; top: 0px; visibility: visible; " tabindex="0" vspace="0" width="100%" id="I1_1336094352298" name="I1_1336094352298" src="./Libraries cookbook to generate XMLi and create invoices - Greendizer_files/fastbutton(1).htm" title="+1"></iframe></div></li>
<li><a hreflang="en" href="https://www.greendizer.com/docs/libraries/downloads/">Downloads</a></li>
</ul>
</li>
<li>
<h1>Widgets</h1>
<ul>
<li><a hreflang="en" href="https://www.greendizer.com/docs/widgets/">Explore</a></li>
<li><a hreflang="en" href="https://www.greendizer.com/docs/widgets/invoicelist/">Invoice List</a></li>
<li><a hreflang="en" href="https://www.greendizer.com/docs/widgets/invoiceviewer/">Invoice Viewer</a></li>
<li><a hreflang="en" href="https://www.greendizer.com/docs/widgets/invoicecreator/">Invoice Creator</a></li>
</ul>
</li>
<li>
<h1>Support</h1>
<ul>
<li><a href="http://code.google.com/p/greendizer-api/">Report issues</a></li>
</ul>
</li>
</ul>
<div style="padding-bottom:20px;" class="clear"></div>
<div>
<div id="cse" style="width: 80%;"><div class="gsc-control-cse gsc-control-cse-en"><div class="gsc-control-wrapper-cse" dir="ltr"><form class="gsc-search-box" accept-charset="utf-8"><table cellspacing="0" cellpadding="0" class="gsc-search-box"><tbody><tr><td class="gsc-input"><input autocomplete="off" type="text" size="10" class=" gsc-input " name="search" title="search" id="gsc-i-id1" dir="ltr" spellcheck="false" style="outline-style: none; outline-width: initial; outline-color: initial; background-image: url(https://www.google.com/cse/intl/en/images/google_custom_search_watermark.gif); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(255, 255, 255); background-position: 0% 50%; background-repeat: no-repeat no-repeat; "></td><td class="gsc-search-button"><input type="button" value="Search" class="gsc-search-button" title="search"></td><td class="gsc-clear-button"><div class="gsc-clear-button" title="clear results">&nbsp;</div></td></tr></tbody></table><table cellspacing="0" cellpadding="0" class="gsc-branding"><tbody><tr><td class="gsc-branding-user-defined"></td><td class="gsc-branding-text"><div class="gsc-branding-text">powered by</div></td><td class="gsc-branding-img"><img src="./Libraries cookbook to generate XMLi and create invoices - Greendizer_files/small-logo.png" class="gsc-branding-img"></td></tr></tbody></table></form><div class="gsc-tabsAreaInvisible"><div class="gsc-tabHeader gsc-inline-block gsc-tabhActive">Custom Search</div><span class="gs-spacer"> </span></div><div class="gsc-tabsAreaInvisible"></div><div class="gsc-above-wrapper-area-invisible"><table cellspacing="0" cellpadding="0" class="gsc-above-wrapper-area-container"><tbody><tr><td class="gsc-result-info-container"><div class="gsc-result-info-invisible"></div></td></tr></tbody></table></div><div class="gsc-adBlockInvisible"></div><div class="gsc-wrapper"><div class="gsc-adBlockInvisible"></div><div class="gsc-resultsbox-invisible"><div class="gsc-resultsRoot gsc-tabData gsc-tabdActive"><table cellspacing="0" cellpadding="0" class="gsc-resultsHeader"><tbody><tr><td class="gsc-twiddleRegionCell"><div class="gsc-twiddle"><div class="gsc-title">Web</div></div><div class="gsc-stats"></div><div class="gsc-results-selector gsc-all-results-active"><div class="gsc-result-selector gsc-one-result" title="show one result">&nbsp;</div><div class="gsc-result-selector gsc-more-results" title="show more results">&nbsp;</div><div class="gsc-result-selector gsc-all-results" title="show all results">&nbsp;</div></div></td><td class="gsc-configLabelCell"></td></tr></tbody></table><div><div class="gsc-expansionArea"></div></div></div></div></div></div></div></div>
<script src="./Libraries cookbook to generate XMLi and create invoices - Greendizer_files/jsapi" type="text/javascript"></script>
<script async="true" type="text/javascript"> 
          google.load('search', '1', {language : 'en'});
          google.setOnLoadCallback(function() {
            var customSearchOptions = {};  var customSearchControl = new google.search.CustomSearchControl(
              '003680668979917808190:068bct4psie', customSearchOptions);
            customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
            customSearchControl.draw('cse');
          }, true);
        </script><script src="./Libraries cookbook to generate XMLi and create invoices - Greendizer_files/saved_resource(2)" type="text/javascript"></script><link href="./Libraries cookbook to generate XMLi and create invoices - Greendizer_files/default+en.css" type="text/css" rel="stylesheet"><script src="./Libraries cookbook to generate XMLi and create invoices - Greendizer_files/default+en.I.js" type="text/javascript"></script>
<link rel="stylesheet" href="./Libraries cookbook to generate XMLi and create invoices - Greendizer_files/www.search.css" type="text/css">
</div>
</section>
<script type="text/javascript">
	$(document).bind("ready", function(){
		var request_url = '/docs/libraries/xmli/'.split("?")[0];
		var submenuDOM = $("#sub-menu");
		
		var cseDOM = $("#cse");
		submenuDOM.data("push-test", function(){
		    return cseDOM.find(".gsc-result-info-invisible").size() !== 0;
		});
		
		target = submenuDOM.find("[href='" + request_url + "']");
		target.parent().addClass("focus").parent().parent().addClass("focus");
		target.parent().html(target.parent().html() + '<g:plusone size="small"></g:plusone>');
	});
</script>
<section id="content-items">
<article class="content-item"><section class="content">
<h3 id="introduction">Introduction</h3>
<div>
<p>The libraries can help you construct your XMLi invoices. Using a set of objects that represent the different components of an invoice, you will be able to generate your XMLi string and send it using a <code>POST</code> request through <a href="https://www.greendizer.com/docs/api/sellers/#collections_invoices">the Greendizer API</a> or by using the <code>send()</code> method in the <a href="https://www.greendizer.com/docs/libraries/sellers/#collections_invoices"><code>InvoiceContainer</code></a></p>
<p>More details are available on the <a href="https://www.greendizer.com/docs/api/xmli/">XMLi reference</a>.
</p></div>
</section></article>
<article class="content-item"><section class="content">
<h3>Content</h3>
<div>
<ul class="tableofcontent">
<li><a href="https://www.greendizer.com/docs/libraries/xmli/#xmli_builder"><code>XMLiBuilder</code></a></li>
<li><a href="https://www.greendizer.com/docs/libraries/xmli/#invoice"><code>Invoice</code></a></li>
<li><a href="https://www.greendizer.com/docs/libraries/xmli/#group"><code>Group</code></a></li>
<li><a href="https://www.greendizer.com/docs/libraries/xmli/#tax_discount"><code>Tax &amp; Discount</code></a></li>
<li><a href="https://www.greendizer.com/docs/libraries/xmli/#line"><code>Line</code></a></li>
<li><a href="https://www.greendizer.com/docs/libraries/xmli/#custom_elements">Custom Elements</a>
<ul>
<li><a href="https://www.greendizer.com/docs/libraries/xmli/#custom_elements_namespaces">Namespaces</a></li>
<li><a href="https://www.greendizer.com/docs/libraries/xmli/#custom_elements_add">Adding elements</a></li>
</ul>
</li>
<li><a href="https://www.greendizer.com/docs/libraries/xmli/#notes">Notes</a></li>
</ul>
</div>
</section></article>
<article class="content-item"><section class="content">
<h3 id="xmli_builder"><code>XMLiBuilder</code></h3>
<div>
<p>The XMLiBuilder is the object generating the XMLi string. The elements of the invoice will be added to it as we shall see.</p>
<div data-group="code-example" class="tab-control" id="1336094351582">
<ul class="tabs">
<li data-name="python" class="rounded-top">Python</li>
<li data-name="php" class="rounded-top">Php</li>
<li data-name="java" class="rounded-top focus">Java</li>

</ul>
<pre class="prettyprint rounded-top tab-panel" style="display: none; "><code class="language-py"><span class="kwd">from</span><span class="pln"> greendizer</span><span class="pun">.</span><span class="pln">xmli </span><span class="kwd">import</span><span class="pln"> </span><span class="typ">XMLiBuilder</span><span class="pln">
            
builder </span><span class="pun">=</span><span class="pln"> </span><span class="typ">XMLiBuilder</span><span class="pun">()</span></code></pre>
<pre class="prettyprint rounded-top tab-panel" style="display: none; "><code class="language-php"><span class="pln">require_once </span><span class="str">'Greendizer/XMLi/XMLiBuilder.php'</span><span class="pun">;</span><span class="pln">

$builder </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">Greendizer_XMLi_XMLiBuilder</span><span class="pun">();</span></code></pre>
<pre class="prettyprint rounded-top tab-panel" style="display: block; "><code class="language-java"><span class="kwd">import</span><span class="pln"> com</span><span class="pun">.</span><span class="pln">greendizer</span><span class="pun">.</span><span class="pln">api</span><span class="pun">.</span><span class="pln">xmli</span><span class="pun">.</span><span class="typ">XMLiBuilder</span><span class="pun">;</span><span class="pln">

</span><span class="typ">XMLiBuilder</span><span class="pln"> builder </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">XMLiBuilder</span><span class="pun">();</span></code></pre>

</div>
</div>
</section></article>
<article class="content-item"><section class="content">
<h3 id="invoice"><code>Invoice</code></h3>
<div>
<p>Represents the invoice element of the XMLi invoice.</p>
<div data-group="code-example" class="tab-control" id="1336094351614">
<ul class="tabs">
<li data-name="python" class="rounded-top">Python</li>
<li data-name="php" class="rounded-top">Php</li>
<li data-name="java" class="rounded-top focus">Java</li>

</ul>
<pre class="prettyprint rounded-top tab-panel" style="padding-bottom: 164px; display: none; "><code class="language-py"><span class="kwd">from</span><span class="pln"> greendizer</span><span class="pun">.</span><span class="pln">xmli </span><span class="kwd">import</span><span class="pln"> </span><span class="pun">*</span><span class="pln">

</span><span class="com">#Instance of the Invoice object</span><span class="pln">
invoice </span><span class="pun">=</span><span class="pln"> </span><span class="typ">Invoice</span><span class="pun">(</span><span class="pln">name</span><span class="pun">=</span><span class="str">"Building and invoice"</span><span class="pun">,</span><span class="pln"> currency</span><span class="pun">=</span><span class="str">"USD"</span><span class="pun">,</span><span class="pln">
                  description</span><span class="pun">=</span><span class="str">"Made with Python"</span><span class="pun">,</span><span class="pln"> status</span><span class="pun">=</span><span class="pln">INVOICE_DUE</span><span class="pun">,</span><span class="pln">
                  date</span><span class="pun">=</span><span class="pln">date</span><span class="pun">.</span><span class="pln">today</span><span class="pun">(),</span><span class="pln"> due_date</span><span class="pun">=</span><span class="pln">date</span><span class="pun">.</span><span class="pln">today</span><span class="pun">()</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> timedelta</span><span class="pun">(</span><span class="pln">days</span><span class="pun">=</span><span class="lit">75</span><span class="pun">),</span><span class="pln">
                  terms</span><span class="pun">=</span><span class="str">"Specific terms and conditions"</span><span class="pun">,</span><span class="pln"> custom_id</span><span class="pun">=</span><span class="str">"IJH1234567"</span><span class="pun">)</span><span class="pln">
                  
invoice</span><span class="pun">.</span><span class="pln">buyer</span><span class="pun">.</span><span class="pln">name </span><span class="pun">=</span><span class="pln"> </span><span class="str">"Jimi Hendrix"</span><span class="pln">
invoice</span><span class="pun">.</span><span class="pln">buyer</span><span class="pun">.</span><span class="pln">email </span><span class="pun">=</span><span class="pln"> </span><span class="str">"jimi.hendrix@springshield.com"</span><span class="pln">
invoice</span><span class="pun">.</span><span class="pln">buyer</span><span class="pun">.</span><span class="pln">address </span><span class="pun">=</span><span class="pln"> </span><span class="typ">Address</span><span class="pun">(</span><span class="pln">street_address</span><span class="pun">=</span><span class="str">"15 rue de Chambéry"</span><span class="pun">,</span><span class="pln">
                                city</span><span class="pun">=</span><span class="str">"Paris"</span><span class="pun">,</span><span class="pln"> zipcode</span><span class="pun">=</span><span class="str">"75015"</span><span class="pun">,</span><span class="pln"> country</span><span class="pun">=</span><span class="str">"FR"</span><span class="pun">)</span><span class="pln">

invoice</span><span class="pun">.</span><span class="pln">shipping</span><span class="pun">.</span><span class="pln">recipient </span><span class="pun">=</span><span class="pln"> invoice</span><span class="pun">.</span><span class="pln">buyer

</span><span class="com">#Add the invoice to the builder</span><span class="pln">
builder</span><span class="pun">.</span><span class="pln">invoices</span><span class="pun">.</span><span class="pln">append</span><span class="pun">(</span><span class="pln">invoice</span><span class="pun">)</span></code></pre>
<pre class="prettyprint rounded-top tab-panel" style="display: none; "><code class="language-php"><span class="pln">require_once </span><span class="str">'Greendizer/XMLi/Invoice.php'</span><span class="pun">;</span><span class="pln">
require_once </span><span class="str">'Greendizer/XMLi/XMLiNamespace.php'</span><span class="pun">;</span><span class="pln">
require_once </span><span class="str">'Greendizer/XMLi/XMLiBuilder.php'</span><span class="pun">;</span><span class="pln">
require_once </span><span class="str">'Greendizer/XMLi/Tax.php'</span><span class="pun">;</span><span class="pln">
require_once </span><span class="str">'Greendizer/XMLi/RateType.php'</span><span class="pun">;</span><span class="pln">
require_once </span><span class="str">'Greendizer/XMLi/Group.php'</span><span class="pun">;</span><span class="pln">
require_once </span><span class="str">'Greendizer/XMLi/Line.php'</span><span class="pun">;</span><span class="pln">

</span><span class="com">//Instance of the Invoice object</span><span class="pln">
$invoice </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">Greendizer_XMLi_Invoice</span><span class="pun">();</span><span class="pln">
$invoice</span><span class="pun">-&gt;</span><span class="pln">setCurrency</span><span class="pun">(</span><span class="str">'EUR'</span><span class="pun">);</span><span class="pln">
$invoice</span><span class="pun">-&gt;</span><span class="pln">setName</span><span class="pun">(</span><span class="str">'Building an invoice'</span><span class="pun">);</span><span class="pln">
$invoice</span><span class="pun">-&gt;</span><span class="pln">setDescription</span><span class="pun">(</span><span class="str">'Invoice built with Python'</span><span class="pun">);</span><span class="pln">
$invoice</span><span class="pun">-&gt;</span><span class="pln">setDate</span><span class="pun">(</span><span class="str">'2011-03-16'</span><span class="pun">);</span><span class="pln">
$invoice</span><span class="pun">-&gt;</span><span class="pln">setDueDate</span><span class="pun">(</span><span class="str">'2011-12-28'</span><span class="pun">);</span><span class="pln">
$invoice</span><span class="pun">-&gt;</span><span class="pln">setStatus</span><span class="pun">(</span><span class="typ">Greendizer_XMLi_InvoiceStatus</span><span class="pun">::</span><span class="pln">DUE</span><span class="pun">);</span><span class="pln">

$invoice</span><span class="pun">-&gt;</span><span class="pln">getBuyer</span><span class="pun">()-&gt;</span><span class="pln">setName</span><span class="pun">(</span><span class="str">"Jimi Hendrix"</span><span class="pun">);</span><span class="pln">
$invoice</span><span class="pun">-&gt;</span><span class="pln">getBuyer</span><span class="pun">()-&gt;</span><span class="pln">setEmail</span><span class="pun">(</span><span class="str">"jimi.hendrix@springshield.com"</span><span class="pun">);</span><span class="pln">
$invoice</span><span class="pun">-&gt;</span><span class="pln">getBuyer</span><span class="pun">()-&gt;</span><span class="pln">setAddress</span><span class="pun">(</span><span class="kwd">new</span><span class="pln"> </span><span class="typ">Greendizer_XMLi_Address</span><span class="pun">());</span><span class="pln">
$invoice</span><span class="pun">-&gt;</span><span class="pln">getBuyer</span><span class="pun">()-&gt;</span><span class="pln">getAddress</span><span class="pun">()-&gt;</span><span class="pln">setNumber</span><span class="pun">(</span><span class="str">'15'</span><span class="pun">);</span><span class="pln">
$invoice</span><span class="pun">-&gt;</span><span class="pln">getBuyer</span><span class="pun">()-&gt;</span><span class="pln">getAddress</span><span class="pun">()-&gt;</span><span class="pln">setStreet</span><span class="pun">(</span><span class="str">'rue de Chambery'</span><span class="pun">);</span><span class="pln">
$invoice</span><span class="pun">-&gt;</span><span class="pln">getBuyer</span><span class="pun">()-&gt;</span><span class="pln">getAddress</span><span class="pun">()-&gt;</span><span class="pln">setZipCode</span><span class="pun">(</span><span class="str">'75015'</span><span class="pun">);</span><span class="pln">
$invoice</span><span class="pun">-&gt;</span><span class="pln">getBuyer</span><span class="pun">()-&gt;</span><span class="pln">getAddress</span><span class="pun">()-&gt;</span><span class="pln">setCity</span><span class="pun">(</span><span class="str">'Paris'</span><span class="pun">);</span><span class="pln">
$invoice</span><span class="pun">-&gt;</span><span class="pln">getBuyer</span><span class="pun">()-&gt;</span><span class="pln">getAddress</span><span class="pun">()-&gt;</span><span class="pln">setCountry</span><span class="pun">(</span><span class="str">'FR'</span><span class="pun">);</span><span class="pln">

</span><span class="com">//Add the invoice to the builder</span><span class="pln">
$builder</span><span class="pun">-&gt;</span><span class="pln">addInvoice</span><span class="pun">(</span><span class="pln">$invoice</span><span class="pun">);</span></code></pre>
<pre class="prettyprint rounded-top tab-panel" style="padding-bottom: 80px; display: block; "><code class="language-java"><span class="kwd">import</span><span class="pln"> com</span><span class="pun">.</span><span class="pln">greendizer</span><span class="pun">.</span><span class="pln">api</span><span class="pun">.</span><span class="pln">xmli</span><span class="pun">.</span><span class="typ">Invoice</span><span class="pun">;</span><span class="pln">

</span><span class="com">//Instance of the Invoice object</span><span class="pln">
</span><span class="typ">Invoice</span><span class="pln"> invoice </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">Invoice</span><span class="pun">();</span><span class="pln">
invoice</span><span class="pun">.</span><span class="pln">setCurrency</span><span class="pun">(</span><span class="typ">CurrencyEnum</span><span class="pun">.</span><span class="pln">EUR</span><span class="pun">);</span><span class="pln">
invoice</span><span class="pun">.</span><span class="pln">setName</span><span class="pun">(</span><span class="str">"Building an invoice"</span><span class="pun">);</span><span class="pln">
invoice</span><span class="pun">.</span><span class="pln">setDescription</span><span class="pun">(</span><span class="str">"Invoice built with Java Library"</span><span class="pun">);</span><span class="pln">
invoice</span><span class="pun">.</span><span class="pln">setDate</span><span class="pun">(</span><span class="kwd">new</span><span class="pln"> java</span><span class="pun">.</span><span class="pln">util</span><span class="pun">.</span><span class="typ">Date</span><span class="pun">());</span><span class="pln">
invoice</span><span class="pun">.</span><span class="pln">setDueDate</span><span class="pun">(</span><span class="kwd">new</span><span class="pln"> java</span><span class="pun">.</span><span class="pln">util</span><span class="pun">.</span><span class="typ">Date</span><span class="pun">());</span><span class="pln">
invoice</span><span class="pun">.</span><span class="pln">setStatus</span><span class="pun">(</span><span class="typ">InvoiceStatusEnum</span><span class="pun">.</span><span class="pln">DUE</span><span class="pun">);</span><span class="pln">

invoice</span><span class="pun">.</span><span class="pln">setRecipientName</span><span class="pun">(</span><span class="str">"Jimi Hendrix"</span><span class="pun">);</span><span class="pln">
invoice</span><span class="pun">.</span><span class="pln">setRecipientEmail</span><span class="pun">(</span><span class="str">"jimi.hendrix@springshield.com"</span><span class="pun">);</span><span class="pln">

</span><span class="com">//Setting the buyer\'s address</span><span class="pln">
invoice</span><span class="pun">.</span><span class="pln">getPostalAddress</span><span class="pun">().</span><span class="pln">setNumber</span><span class="pun">(</span><span class="str">"15"</span><span class="pun">);</span><span class="pln">
invoice</span><span class="pun">.</span><span class="pln">getPostalAddress</span><span class="pun">().</span><span class="pln">setStreet</span><span class="pun">(</span><span class="str">"rue de Chambéry"</span><span class="pun">);</span><span class="pln">
invoice</span><span class="pun">.</span><span class="pln">getPostalAddress</span><span class="pun">().</span><span class="pln">setZipcode</span><span class="pun">(</span><span class="str">"75015"</span><span class="pun">);</span><span class="pln">
invoice</span><span class="pun">.</span><span class="pln">getPostalAddress</span><span class="pun">().</span><span class="pln">setCity</span><span class="pun">(</span><span class="str">"Paris"</span><span class="pun">);</span><span class="pln">
invoice</span><span class="pun">.</span><span class="pln">getPostalAddress</span><span class="pun">().</span><span class="pln">setCountry</span><span class="pun">(</span><span class="str">"FR"</span><span class="pun">);</span><span class="pln">

</span><span class="com">//Add the invoice to the builder</span><span class="pln">
builder</span><span class="pun">.</span><span class="pln">addChild</span><span class="pun">(</span><span class="pln">invoice</span><span class="pun">);</span></code></pre>

</div>
</div>
</section></article>
<article class="content-item"><section class="content">
<h3 id="group"><code>Group</code></h3>
<div>
<p>Represents a group of lines in the invoice</p>
<div data-group="code-example" class="tab-control" id="1336094351647">
<ul class="tabs">
<li data-name="python" class="rounded-top">Python</li>
<li data-name="php" class="rounded-top">Php</li>
<li data-name="java" class="rounded-top focus">Java</li>

</ul>
<pre class="prettyprint rounded-top tab-panel" style="padding-bottom: 66px; display: none; "><code class="language-py"><span class="com">#Initialize a group to organize lines</span><span class="pln">
group </span><span class="pun">=</span><span class="pln"> </span><span class="typ">Group</span><span class="pun">(</span><span class="pln">name</span><span class="pun">=</span><span class="str">'Group name'</span><span class="pun">,</span><span class="pln"> description</span><span class="pun">=</span><span class="str">'Group description'</span><span class="pun">)</span><span class="pln">

</span><span class="com">#Add the group the list of groups in the invoice</span><span class="pln">
invoice</span><span class="pun">.</span><span class="pln">groups</span><span class="pun">.</span><span class="pln">append</span><span class="pun">(</span><span class="pln">group</span><span class="pun">)</span></code></pre>
<pre class="prettyprint rounded-top tab-panel" style="padding-bottom: 38px; display: none; "><code class="language-php"><span class="com">//Initialize a group to organize lines</span><span class="pln">
$group </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">Greendizer_XMLi_Group</span><span class="pun">();</span><span class="pln">
$group</span><span class="pun">-&gt;</span><span class="pln">setName</span><span class="pun">(</span><span class="str">'Group name'</span><span class="pun">);</span><span class="pln">
$group</span><span class="pun">-&gt;</span><span class="pln">setDescription</span><span class="pun">(</span><span class="str">'Group description'</span><span class="pun">);</span><span class="pln">

</span><span class="com">//Add the group the list of groups in the invoice</span><span class="pln">
$invoice</span><span class="pun">-&gt;</span><span class="pln">addGroup</span><span class="pun">(</span><span class="pln">$group</span><span class="pun">);</span></code></pre>
<pre class="prettyprint rounded-top tab-panel" style="display: block; "><code class="language-java"><span class="kwd">import</span><span class="pln"> com</span><span class="pun">.</span><span class="pln">greendizer</span><span class="pun">.</span><span class="pln">api</span><span class="pun">.</span><span class="pln">xmli</span><span class="pun">.</span><span class="typ">Group</span><span class="pun">;</span><span class="pln">

</span><span class="com">//Initialize a group to organize lines</span><span class="pln">
</span><span class="typ">Group</span><span class="pln"> group </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">Group</span><span class="pun">();</span><span class="pln">
group</span><span class="pun">.</span><span class="pln">setName</span><span class="pun">(</span><span class="str">"Main name"</span><span class="pun">);</span><span class="pln">
group</span><span class="pun">.</span><span class="pln">setDescription</span><span class="pun">(</span><span class="str">"Group description"</span><span class="pun">);</span><span class="pln">

</span><span class="com">//Adding the group to an invoice</span><span class="pln">
invoice</span><span class="pun">.</span><span class="pln">addChild</span><span class="pun">(</span><span class="pln">group</span><span class="pun">);</span></code></pre>

</div>
</div>
</section></article>
<article class="content-item"><section class="content">
<h3 id="tax_discount"><code>Tax &amp; Discount</code></h3>
<div>
<p>Represents a tax or a discount to be applied to a line.</p>
<div data-group="code-example" class="tab-control" id="1336094351670">
<ul class="tabs">
<li data-name="python" class="rounded-top">Python</li>
<li data-name="php" class="rounded-top">Php</li>
<li data-name="java" class="rounded-top focus">Java</li>

</ul>
<pre class="prettyprint rounded-top tab-panel" style="padding-bottom: 136px; display: none; "><code class="language-py"><span class="com">#Initialize a Tax instance that you'll apply to the lines</span><span class="pln">
tax </span><span class="pun">=</span><span class="pln"> </span><span class="typ">Tax</span><span class="pun">(</span><span class="pln">name</span><span class="pun">=</span><span class="str">'Tax name" #VAT for example'</span><span class="pun">,</span><span class="pln"> rate</span><span class="pun">=</span><span class="lit">19.6</span><span class="pun">,</span><span class="pln">
           description</span><span class="pun">=</span><span class="str">'Description of the tax'</span><span class="pun">,</span><span class="pln">
           rate_type</span><span class="pun">=</span><span class="pln">RATE_TYPE_FIXED</span><span class="pun">)</span><span class="pln"> </span><span class="com">#could also be RATE_TYPE_PERCENTAGE</span><span class="pln">

</span><span class="com">#Initialize work the exact same way</span><span class="pln">
discount </span><span class="pun">=</span><span class="pln"> </span><span class="typ">Discount</span><span class="pun">(</span><span class="pln">name</span><span class="pun">=</span><span class="str">"Discount name"</span><span class="pun">,</span><span class="pln"> description</span><span class="pun">=</span><span class="str">'Discount description'</span><span class="pun">,</span><span class="pln">
                    rate</span><span class="pun">=</span><span class="lit">50</span><span class="pun">,</span><span class="pln"> rate_type</span><span class="pun">=</span><span class="pln">RATE_TYPE_PERCENTAGE</span><span class="pun">)</span></code></pre>
<pre class="prettyprint rounded-top tab-panel" style="padding-bottom: 66px; display: none; "><code class="language-php"><span class="com">//Initialize a Tax instance that you'll apply to the lines</span><span class="pln">
$tax </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">Greendizer_XMLi_Tax</span><span class="pun">();</span><span class="pln">
$tax</span><span class="pun">-&gt;</span><span class="pln">setName</span><span class="pun">(</span><span class="str">'Tax name'</span><span class="pun">);</span><span class="pln"> </span><span class="com">//VAT for example</span><span class="pln">
$tax</span><span class="pun">-&gt;</span><span class="pln">setDescription</span><span class="pun">(</span><span class="str">'Description of the tax'</span><span class="pun">);</span><span class="pln">
$tax</span><span class="pun">-&gt;</span><span class="pln">setRate</span><span class="pun">(</span><span class="lit">19.6</span><span class="pun">);</span><span class="pln">
$tax</span><span class="pun">-&gt;</span><span class="pln">setType</span><span class="pun">(</span><span class="typ">Greendizer_XMLi_RateType</span><span class="pun">::</span><span class="pln">FIXED</span><span class="pun">);</span><span class="pln">		</span><span class="com">//Could also be PERCENTAGE </span><span class="pln">

</span><span class="com">//Initialize work the exact same way</span><span class="pln">
$discount </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">Greendizer_XMLi_Discount</span><span class="pun">();</span><span class="pln">
$discount</span><span class="pun">-&gt;</span><span class="pln">setName</span><span class="pun">(</span><span class="str">'Discount name'</span><span class="pun">);</span><span class="pln">
$discount</span><span class="pun">-&gt;</span><span class="pln">setDescription</span><span class="pun">(</span><span class="str">'Discount description'</span><span class="pun">);</span><span class="pln">
$discount</span><span class="pun">-&gt;</span><span class="pln">setRate</span><span class="pun">(</span><span class="lit">50</span><span class="pun">);</span><span class="pln">
$discount</span><span class="pun">-&gt;</span><span class="pln">setType</span><span class="pun">(</span><span class="typ">Greendizer_XMLi_RateType</span><span class="pun">::</span><span class="pln">PERCENTAGE</span><span class="pun">);</span><span class="pln">	</span><span class="com">//could also be FIXED</span></code></pre>
<pre class="prettyprint rounded-top tab-panel" style="display: block; "><code class="language-java"><span class="kwd">import</span><span class="pln"> com</span><span class="pun">.</span><span class="pln">greendizer</span><span class="pun">.</span><span class="pln">api</span><span class="pun">.</span><span class="pln">xmli</span><span class="pun">.</span><span class="typ">Group</span><span class="pun">;</span><span class="pln">
</span><span class="kwd">import</span><span class="pln"> com</span><span class="pun">.</span><span class="pln">greendizer</span><span class="pun">.</span><span class="pln">api</span><span class="pun">.</span><span class="pln">xmli</span><span class="pun">.</span><span class="typ">Tax</span><span class="pun">;</span><span class="pln">
</span><span class="kwd">import</span><span class="pln"> com</span><span class="pun">.</span><span class="pln">greendizer</span><span class="pun">.</span><span class="pln">api</span><span class="pun">.</span><span class="pln">xmli</span><span class="pun">.</span><span class="typ">Discount</span><span class="pun">;</span><span class="pln">

</span><span class="com">//Declaring a Tax</span><span class="pln">
</span><span class="typ">Tax</span><span class="pln"> tax </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">Tax</span><span class="pun">();</span><span class="pln">
tax</span><span class="pun">.</span><span class="pln">setName</span><span class="pun">(</span><span class="str">"Tax name"</span><span class="pun">);</span><span class="pln">
tax</span><span class="pun">.</span><span class="pln">setDescription</span><span class="pun">(</span><span class="str">"Description of the tax"</span><span class="pun">);</span><span class="pln">
tax</span><span class="pun">.</span><span class="pln">setRate</span><span class="pun">(</span><span class="lit">19.6</span><span class="pun">);</span><span class="pln"> </span><span class="com">//VAT for example</span><span class="pln">
tax</span><span class="pun">.</span><span class="pln">setType</span><span class="pun">(</span><span class="typ">RateTypeEnum</span><span class="pun">.</span><span class="pln">FIXED</span><span class="pun">);</span><span class="pln"> </span><span class="com">//could also be PERCENTAGE</span><span class="pln">

</span><span class="com">//Declaring a Discount</span><span class="pln">
</span><span class="typ">Discount</span><span class="pln"> discount </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">Discount</span><span class="pun">();</span><span class="pln">
discount</span><span class="pun">.</span><span class="pln">setName</span><span class="pun">(</span><span class="str">"Discount name"</span><span class="pun">);</span><span class="pln">
discount</span><span class="pun">.</span><span class="pln">setDescription</span><span class="pun">(</span><span class="str">"Discount description"</span><span class="pun">);</span><span class="pln">
discount</span><span class="pun">.</span><span class="pln">setRate</span><span class="pun">(</span><span class="lit">50</span><span class="pun">);</span><span class="pln">
discount</span><span class="pun">.</span><span class="pln">setType</span><span class="pun">(</span><span class="typ">RateTypeEnum</span><span class="pun">.</span><span class="pln">FIXED</span><span class="pun">);</span><span class="pln"> </span><span class="com">//could also be FIXED</span></code></pre>

</div>
</div>
</section></article>
<article class="content-item"><section class="content">
<h3 id="line"><code>Line</code></h3>
<div>
<p>Represents a line in the invoice.</p>
<div data-group="code-example" class="tab-control" id="1336094351696">
<ul class="tabs">
<li data-name="python" class="rounded-top">Python</li>
<li data-name="php" class="rounded-top">Php</li>
<li data-name="java" class="rounded-top focus">Java</li>

</ul>
<pre class="prettyprint rounded-top tab-panel" style="padding-bottom: 52px; display: none; "><code class="language-py"><span class="pln">
line </span><span class="pun">=</span><span class="pln"> </span><span class="typ">Line</span><span class="pun">(</span><span class="pln">name</span><span class="pun">=</span><span class="str">'Service or product name'</span><span class="pun">,</span><span class="pln"> 
            description</span><span class="pun">=</span><span class="str">'Service or product description'</span><span class="pun">,</span><span class="pln">
            quantity</span><span class="pun">=</span><span class="lit">1</span><span class="pun">,</span><span class="pln"> unit_price</span><span class="pun">=</span><span class="lit">5000</span><span class="pun">,</span><span class="pln"> date</span><span class="pun">=</span><span class="pln">date</span><span class="pun">.</span><span class="pln">today</span><span class="pun">())</span><span class="pln">
            
line</span><span class="pun">.</span><span class="pln">taxes</span><span class="pun">.</span><span class="pln">append</span><span class="pun">(</span><span class="pln">tax</span><span class="pun">)</span><span class="pln">
line</span><span class="pun">.</span><span class="pln">discounts</span><span class="pun">.</span><span class="pln">append</span><span class="pun">(</span><span class="pln">discount</span><span class="pun">)</span><span class="pln">
group</span><span class="pun">.</span><span class="pln">lines</span><span class="pun">.</span><span class="pln">apppend</span><span class="pun">(</span><span class="pln">line</span><span class="pun">)</span></code></pre>
<pre class="prettyprint rounded-top tab-panel" style="padding-bottom: 38px; display: none; "><code class="language-php"><span class="pln">$line </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">Greendizer_XMLi_Line</span><span class="pun">();</span><span class="pln">
$line</span><span class="pun">-&gt;</span><span class="pln">setName</span><span class="pun">(</span><span class="str">'Service or product name'</span><span class="pun">);</span><span class="pln">
$line</span><span class="pun">-&gt;</span><span class="pln">setDescription</span><span class="pun">(</span><span class="str">'Service or product description'</span><span class="pun">);</span><span class="pln">
$line</span><span class="pun">-&gt;</span><span class="pln">setQuantity</span><span class="pun">(</span><span class="str">'1'</span><span class="pun">);</span><span class="pln">
$line</span><span class="pun">-&gt;</span><span class="pln">setUnitPrice</span><span class="pun">(</span><span class="str">'5000'</span><span class="pun">);</span><span class="pln">
$line</span><span class="pun">-&gt;</span><span class="pln">setDate</span><span class="pun">(</span><span class="str">'2011-03-10'</span><span class="pun">);</span><span class="pln">
$line</span><span class="pun">-&gt;</span><span class="pln">addTax</span><span class="pun">(</span><span class="pln">$tax</span><span class="pun">);</span><span class="pln">
$line</span><span class="pun">-&gt;</span><span class="pln">addDiscount</span><span class="pun">(</span><span class="pln">$discount</span><span class="pun">);</span><span class="pln">
$group</span><span class="pun">-&gt;</span><span class="pln">addLine</span><span class="pun">(</span><span class="pln">$line</span><span class="pun">);</span></code></pre>
<pre class="prettyprint rounded-top tab-panel" style="display: block; "><code class="language-java"><span class="kwd">import</span><span class="pln"> com</span><span class="pun">.</span><span class="pln">greendizer</span><span class="pun">.</span><span class="pln">api</span><span class="pun">.</span><span class="pln">xmli</span><span class="pun">.</span><span class="typ">Line</span><span class="pun">;</span><span class="pln">

</span><span class="typ">Line</span><span class="pln"> line </span><span class="pun">=</span><span class="pln"> </span><span class="typ">Line</span><span class="pun">();</span><span class="pln">
line</span><span class="pun">.</span><span class="pln">setName</span><span class="pun">(</span><span class="str">"Service or product name"</span><span class="pun">);</span><span class="pln">
line</span><span class="pun">.</span><span class="pln">setDescription</span><span class="pun">(</span><span class="str">"Service or product description"</span><span class="pun">);</span><span class="pln">
line</span><span class="pun">.</span><span class="pln">setQuantity</span><span class="pun">(</span><span class="lit">1</span><span class="pun">);</span><span class="pln">
line</span><span class="pun">.</span><span class="pln">setUnitPrice</span><span class="pun">(</span><span class="lit">5000</span><span class="pun">);</span><span class="pln">
line</span><span class="pun">.</span><span class="pln">setDate</span><span class="pun">(</span><span class="kwd">new</span><span class="pln"> java</span><span class="pun">.</span><span class="pln">util</span><span class="pun">.</span><span class="typ">Date</span><span class="pun">());</span><span class="pln">
line</span><span class="pun">.</span><span class="pln">addTax</span><span class="pun">(</span><span class="pln">tax</span><span class="pun">);</span><span class="pln">
line</span><span class="pun">.</span><span class="pln">addDiscount</span><span class="pun">(</span><span class="pln">discount</span><span class="pun">);</span><span class="pln">
group</span><span class="pun">.</span><span class="pln">addChild</span><span class="pun">(</span><span class="pln">line</span><span class="pun">);</span></code></pre>

</div>
</div>
</section></article>
<article class="content-item"><section class="content">
<h3 id="custom_elements">Custom Elements</h3>
<div>
<h4 id="custom_elements_namespaces">Namespaces</h4>
<p>You can declare your custom namespaces as follow</p>
<div data-group="code-example" class="tab-control" id="1336094351720">
<ul class="tabs">
<li data-name="python" class="rounded-top">Python</li>
<li data-name="php" class="rounded-top">Php</li>
<li data-name="java" class="rounded-top focus">Java</li>

</ul>
<pre class="prettyprint rounded-top tab-panel" style="padding-bottom: 38px; display: none; "><code class="language-py"><span class="pln">company_ns </span><span class="pun">=</span><span class="pln"> </span><span class="str">"myCompany:http://example.mycompany.com"</span></code></pre>
<pre class="prettyprint rounded-top tab-panel" style="padding-bottom: 38px; display: none; "><code class="language-php"><span class="pln">company_ns </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">XMLNamespace</span><span class="pun">(</span><span class="str">"myCompany"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"http://example.mycompany.com"</span><span class="pun">);</span></code></pre>
<pre class="prettyprint rounded-top tab-panel" style="display: block; "><code class="language-java"><span class="kwd">import</span><span class="pln"> com</span><span class="pun">.</span><span class="pln">greendizer</span><span class="pun">.</span><span class="pln">api</span><span class="pun">.</span><span class="pln">xmli</span><span class="pun">.</span><span class="typ">XMLNamespace</span><span class="pun">;</span><span class="pln">

</span><span class="typ">XMLNamespace</span><span class="pln"> namespace </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">XMLNamespace</span><span class="pun">(</span><span class="str">"myCompany"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"http://example.mycompany.com"</span><span class="pun">);</span></code></pre>

</div>
<h4 id="custom_elements_add">Adding elements</h4>
<p>You can add custom elements to the body of the invoice, to group, or to line.</p>
<div data-group="code-example" class="tab-control" id="1336094351741">
<ul class="tabs">
<li data-name="python" class="rounded-top">Python</li>
<li data-name="php" class="rounded-top">Php</li>
<li data-name="java" class="rounded-top focus">Java</li>

</ul>
<pre class="prettyprint rounded-top tab-panel" style="display: none; "><code class="language-py"><span class="pln">group</span><span class="pun">[</span><span class="pln">company_ns</span><span class="pun">][</span><span class="str">'group_custom_field'</span><span class="pun">]</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="str">'group custom field value'</span><span class="pln">
           
line</span><span class="pun">[</span><span class="pln">company_ns</span><span class="pun">][</span><span class="str">'line_custom_field'</span><span class="pun">]</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="str">"line custom field value"</span></code></pre>
<pre class="prettyprint rounded-top tab-panel" style="display: none; "><code class="language-php"><span class="pln">$group</span><span class="pun">-&gt;</span><span class="pln">setCustomElement</span><span class="pun">(</span><span class="pln">$company_ns</span><span class="pun">,</span><span class="pln"> </span><span class="str">'group_custom_field'</span><span class="pun">,</span><span class="pln"> </span><span class="str">'group custom field value'</span><span class="pun">);</span><span class="pln">

$invoice</span><span class="pun">-&gt;</span><span class="pln">setCustomElement</span><span class="pun">(</span><span class="pln">$company_ns</span><span class="pun">,</span><span class="pln"> </span><span class="str">'line_custom_field'</span><span class="pun">,</span><span class="pln"> </span><span class="str">'line custom field value'</span><span class="pun">);</span></code></pre>
<pre class="prettyprint rounded-top tab-panel" style="padding-bottom: 24px; display: block; "><code class="language-java"><span class="com">//Adding a custom element to a group</span><span class="pln">
group</span><span class="pun">.</span><span class="pln">setCustomElement</span><span class="pun">(</span><span class="pln">namespace</span><span class="pun">,</span><span class="pln"> </span><span class="str">"group_custom_field"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"group custom field value"</span><span class="pun">);</span></code></pre>

</div>
</div>
</section></article>
<article class="content-item"><section class="content">
<h3 id="notes">Notes</h3>
<div>
<p>Version: 2.1</p>
<p>Last update: Feb 6<sup>th</sup>, 2012.</p>
<p>Contact: <a href="mailto:developers@greendizer.com">developers@greendizer.com</a></p>
</div>
</section></article>
</section>
</section>
<script type="text/javascript">
(function(){var instance = greendizer.website.Context.getInstance();(window.GREENDIZER_PROTECTED !== false) && instance.login();})();
("prettyPrint" in window) && prettyPrint();
</script>
<div id="push"></div>
</div>
<footer>
<div id="pre-footer">
<ol id="breadcrumbs" class="footer">
<li itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb" title="Home"><a itemprop="url" href="https://www.greendizer.com/"><img style="vertical-align: text-bottom; width:16px; height:16px;" alt="Home" src="./Libraries cookbook to generate XMLi and create invoices - Greendizer_files/gd16bw.png"></a></li>
<li itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"><a itemprop="url" href="https://www.greendizer.com/docs/"><span itemprop="title">Documentation and Resources</span></a></li>
<li itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"><a itemprop="url" href="https://www.greendizer.com/docs/libraries/"><span itemprop="title">Libraries</span></a></li>
<li itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"><a itemprop="url" href="./Libraries cookbook to generate XMLi and create invoices - Greendizer_files/Libraries cookbook to generate XMLi and create invoices - Greendizer.htm"><span itemprop="title">XMLi</span></a></li>
</ol>
</div>
<nav>
<section>
<h1>Product</h1>
<ul>
<li><a title="Back to the home page" href="https://www.greendizer.com/">Home</a></li>
<li><a title="Explore the amazing features of Greendizer" href="https://www.greendizer.com/features/">Features</a></li>
<li><a title="More about our pricing" href="https://www.greendizer.com/pricing/">Pricing</a></li>
<li><a title="Visit our support site" href="http://support.greendizer.com/">Support</a></li>
</ul>
</section>
<section>
<h1>Docs</h1>
<ul>
<li><a title="Get started with our REST API, libs, widgets and tools to build apps." hreflang="en" href="https://www.greendizer.com/docs/">Get started</a></li>
<li><a title="REST API reference" hreflang="en" href="https://www.greendizer.com/docs/api/">API</a></li>
<li><a title="Invoicing and invoice-querying helper libs in languages like Python, Java, PHP and more" hreflang="en" href="https://www.greendizer.com/docs/libraries/">Libraries</a></li>
<li><a title="Powerful widgets to get the most out of Greendizer" hreflang="en" href="https://www.greendizer.com/docs/widgets/">Widgets</a></li>
</ul>
</section>
<section>
<h1>Company</h1>
<ul>
<li><a title="More about the company, the team and how to connect with both" href="https://www.greendizer.com/company/">About Greendizer</a></li>
<li><a title="Check out our blog for news, discussions and new features" href="https://www.greendizer.com/blog/">Blog</a></li>
<li>
<a target="_blank" title="Join us on Google+" href="https://plus.google.com/118361734809275351334">Google+</a>
<div id="___plusone_1" style="height: 15px; width: 70px; display: inline-block; text-indent: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; float: none; line-height: normal; font-size: 1px; vertical-align: baseline; background-position: initial initial; background-repeat: initial initial; "><iframe allowtransparency="true" frameborder="0" hspace="0" marginheight="0" marginwidth="0" scrolling="no" style="width: 70px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; height: 15px; position: static; left: 0px; top: 0px; visibility: visible; " tabindex="0" vspace="0" width="100%" id="I2_1336094352319" name="I2_1336094352319" src="./Libraries cookbook to generate XMLi and create invoices - Greendizer_files/fastbutton.htm" title="+1"></iframe></div>
</li>
<li>
<a target="_blank" title="Interact with Greendizer on Facebook" href="http://www.facebook.com/greendizer/">Facebook</a>
</li>
<li><a target="_blank" title="Follow Greendizer on Twitter" href="http://twitter.com/greendizer/">Twitter</a></li>
</ul>
</section>
<section>
<h1>Policies</h1>
<ul>
<li><a title="Terms of use of Greendizer" hreflang="en" href="https://www.greendizer.com/tos/">Terms of service</a></li>
</ul>
</section>
<section class="text">
<img width="92" height="92" alt="Greendizer" src="./Libraries cookbook to generate XMLi and create invoices - Greendizer_files/gd_dark.png">
<p id="sitemap-link"><a title="Greendizer.com Site Map" href="https://www.greendizer.com/sitemap/">Site map</a></p>
<p>©2012 - All rights reserved.</p>
</section>
<div class="clear"></div>
</nav>
</footer>
<script type="text/javascript">
            (function() {
                window.___gcfg = {
                    lang: 'en',
                    parsetags: 'onload'
                };
                var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
                po.src = 'https://apis.google.com/js/plusone.js';
                var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
              })();
        </script>


<table cellspacing="0" cellpadding="0" style="display: none; top: 346px; width: 218px; left: 524px; position: absolute; " class="gstl_0 gssb_c"><tbody><tr><td class="gssb_f"></td><td class="gssb_e" style="width: 100%; "></td></tr></tbody></table></body></html>